import $ from '../common';
Page({
  data: {
    region: ['', '', ''],
    customItem: '全部'
  },
  onLoad(e) {

  },
  onShow() {

  },
  onChange(e){
    this.setData({
      name:e.detail
    })
  },
  onClick(e){
    $.get('/campus/query',{
      name:this.data.name||'',
      zonecode:this.data.code||''
    },res=>{
      this.setData({
        studentList:res.campuss
      })
    })
  },
  bindRegionChange: function (e) {
    let code=''
    if(e.detail.code[2]){
      code=e.detail.code[2]
    }else if(e.detail.code[1]){
      code=e.detail.code[1]
    }else if(e.detail.code[0]){
      code=e.detail.code[0]
    }
    this.setData({
      region: e.detail.value,
      code      
    })
  },
  radioChange(e){
    let index=e.detail.value
    $.parent().setData({
      'info.campus_name':this.data.studentList[index].name,
      'info.campus_uuid':this.data.studentList[index].uuid,
    })
    $.navigateBack()  
  }
})